﻿using Microsoft.Xna.Framework;
using System.Collections.Generic;

namespace KEA.Core
{
    abstract class Physics
    {
        protected Dictionary<string, Vector2> forces = new Dictionary<string, Vector2>();
        
        public Vector2 acceleration
        {
            get
            {
                Vector2 somme = Vector2.Zero;
                foreach (KeyValuePair<string, Vector2> f in forces)
                {
                    somme += f.Value;
                }
                return somme;
            }
            set 
            {
                acceleration = value;
            }
        }

        public void addForce(string name,Vector2 force)
        {
            forces.Add(name, force);
        }
        public Vector2 getForce(string name)
        {
            Vector2 force = Vector2.Zero;
            if(forces.TryGetValue(name, out force))
                return force;
            else
                throw new KeyNotFoundException("La force " + name +" n'a pas été trouvé");
        }
    }
}
